SP Voice Text (reference; lines; first; last; flags) -> err
reference integer specifys the channel you want to close. Use the
reference number obtained from the
SP Open Voice function.
lines text is a text variable or field which contains the
text you want to be spoken.
first integer specifys on which location to start reading.
last integer specifying on which location to stop reading.
This is the position of the last character selected
plus one!
flags long int allows you to control the behaviours of the
voice. You can pass the (sum of the) numbers
below:
0 Normal behaviour
1 No ending prodosy (cadance at end of statement is turned
off)
2 No speech interrupt (passing other text while speaking
returns an error)
4 Start and pause immediatly (speech starts after call to
SP Voice Cont)
(These are implemented with Speech Manager 1.1.1, see
the SpeakBuffer function in the Speech Manager
documentation.)
err integer returns the error which occured.
A value of zero indicates no error occured. See
below for a list of possible errors.
Speaks the text you pass using the voice of the open speech channel you specify. You can also specify at which location to start and stop speaking.
The ”first“ and ”last“ parameters work like the parameters used with the standard GET HIGHLIGHT and HIGHLIGHT TEXT 4D commands.
The specified selection of the text will be spoken and control will return to 4D as soon as the voice synthesizer is started speaking.
If one of the ”first“ and ”last“ parameters is negative, zero or if they are equal the full text will be read to you. And, ofcourse, also when ”first“ is one (1) and ”last“ is the length of the text plus one.
The lines you pass and which will be spoken are copied and this copy is used to speak. If you specify a valid ”first“ and ”last“ parameter only the text in between these two positions will be copied, in order to save memory. You can then do whatever you want, including unload/cancel any record or clearing the variable or field after calling this function.
If the specified speech channel is already speaking text, this will be stopped immediatly, unless the ”No speech interrupt“ flag was set when the previous text was passed. Then an error is returned (-242).
Examples:
`these all have the same effect
$err := SP Voice Text ($speechref;[File 1]Description;0;0;0)
$err := SP Voice Text ($speechref;[File 1]Description;1;
Length([File 1]Description) + 1;0)
`and this one will ignore the last character
$err := SP Voice Text ($speechref;[File 1]Description;1;
Length([File 1]Description);0)
`and this one will only say "Speech Manager"
$lines := "Testing Speech Manager"
$err := SP Voice Text ($speechref;$lines;9;Length($lines) + 1;0)
Possible errors:
0 No Error
-4 Speech Pack can not be used (Speech Mgr not available)
-108 Not enough memory to load voice into memory
-111 Tried to dispose an already disposed non-relocatable block
-205 Bad channel, speaker volume is too low or Speech Pack disabled